/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.converter;

import br.com.deployment.entidade.acesso.Grupo;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

/**
 *
 * @author elyjr
 */

@FacesConverter(value="grupoConverter")
public class GrupoConverter implements Converter{

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        Grupo grupo = new Grupo();
        grupo.setId(Integer.valueOf(value));  
        return grupo;
    }

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
         Grupo grupo = (Grupo) value;
        return "" + grupo.getId();
    }
    
    
}
